<?php
class Contact extends CI_Controller {


 public function __construct()
       {
            parent::__construct();
        	$this->output->enable_profiler(PROFILER);
       }	

	public function index() {
		$data['name'] = "Raul Ivan Garcia Valdivia";
		$data['main_content'] = "public/contact/index";
		$this -> load -> view("includes/public/template", $data);
	}

	public function send() {
			$this->load->model("contactmodel");
		if ($this -> form_validation -> run('contact/send') == TRUE) {

			$id = $this -> contactmodel -> add($_POST);

			if ($id) {
				redirect('contact/thankyou');
			} else {
				redirect('contact/sorry');
			}

		}
		else{
			
		$data['main_content'] = "public/contact/index";
		$this -> load -> view("includes/public/template", $data);
			
		}
		
		
	}
	
	
	public function thankyou(){
		
		$data['name'] = "Raul Ivan Garcia Valdivia";
		$data['main_content'] = "public/contact/thankyou";
		$this -> load -> view("includes/public/template", $data);
		
	}
	
	public function sorry(){
		
		$data['name'] = "Raul Ivan Garcia Valdivia";
		$data['main_content'] = "public/contact/sorry";
		$this -> load -> view("includes/public/template", $data);
		
	}
	

}
?>